<?xml version="1.0" encoding="UTF-8"?>
<ui:component xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich">

	<ui:composition template="/pages/templates/layout_principal.xhtml">
		<ui:define name="message">
			<rich:messages globalOnly="true" showSummary="true" showDetail="true">
			</rich:messages>
		</ui:define>

		<ui:define name="body">
			<h:form>
				<h:panelGrid styleClass="titulo">
					<h:outputText styleClass="titulo" value="#{menuControl.nomeProjetoSelecionado} - Novo Requisito"  />
				</h:panelGrid>
				
				<br />
				
				<h:panelGrid columns="2">
					<h:outputText value="*Requisito:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputText value="#{manterRequisitosControl.requisito.nome}" id="nome" required="true" maxlength="40" size="50" />
						<rich:message for="nome" />
					</h:panelGroup>
					
					<h:outputText value="*Tipo:" styleClass="form_label" />
					<h:panelGroup>
						<h:selectOneRadio value="#{manterRequisitosControl.requisito.tipo}" id="tipo" required="true">
							<f:selectItems value="#{manterRequisitosControl.tiposRequisito}" var="tipo"
								itemValue="#{tipo}" 
								itemLabel="#{tipo.descricao}" />
						</h:selectOneRadio>
						<rich:message for="tipo" />
					</h:panelGroup>
					
					<h:outputText value="Descrição:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputTextarea value="#{manterRequisitosControl.requisito.descricao}" id="descricao" cols="50" rows="4">
							<f:validateLength maximum="200" />
						</h:inputTextarea>
						<rich:message for="descricao" />
					</h:panelGroup>
					
					<h:outputText value="*Prioridade:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputText value="#{manterRequisitosControl.requisito.prioridade}" id="prioridade" required="true" maxlength="2" size="5" />
						<rich:message for="prioridade" />
					</h:panelGroup>
					
					<h:outputText value="*Situação:" styleClass="form_label" />
					<h:panelGroup>
						<h:selectOneMenu value="#{manterRequisitosControl.requisito.situacao}">
							<f:selectItems value="#{manterRequisitosControl.situacoes}" var="s"
								itemValue="#{s}" itemLabel="#{s.descricao}" />
						</h:selectOneMenu>
						<rich:message for="situacao" />
					</h:panelGroup>
					
					<h:outputText value="Solicitante:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputText value="#{manterRequisitosControl.requisito.solicitante}" id="solicitante" maxlength="80" size="90" />
						<rich:message for="solicitante" />
					</h:panelGroup>
					
					<h:outputText value="Estabilidade:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputText value="#{manterRequisitosControl.requisito.estabilidade}" id="estabilidade" maxlength="2" size="5" />
						<rich:message for="estabilidade" />
					</h:panelGroup>
					
					<h:outputText value="Impacto na Arquitetura:" styleClass="form_label" />
					<h:panelGroup>
						<h:inputText value="#{manterRequisitosControl.requisito.impactoArquitetura}" id="impactoArquitetura" maxlength="2" size="5" />
						<rich:message for="impactoArquitetura" />
					</h:panelGroup>
					
					<rich:jQuery selector="#prioridade" query="mask('?99', {placeholder: ''})" />
					<rich:jQuery selector="#estabilidade" query="mask('?99', {placeholder: ''})" />
					<rich:jQuery selector="#impactoArquitetura" query="mask('?99', {placeholder: ''})" />
				</h:panelGrid>
				
				<br />
				
				<h:panelGrid columns="3" cellpadding="3" styleClass="botoes">
					<h:commandButton action="#{manterRequisitosControl.incluir}" value="Incluir" rendered="#{manterRequisitosControl.exibirIncluir}" />
					<h:commandButton action="#{manterRequisitosControl.alterar}" value="Alterar" rendered="#{manterRequisitosControl.exibirAlterar}" />
					<h:commandButton action="#{manterRequisitosControl.iniciar}" value="Voltar" immediate="true" />
				</h:panelGrid>
			</h:form>
		</ui:define>
	</ui:composition>

</ui:component>